package com.example.onlineeducation.data.model

import android.os.Parcelable
import androidx.recyclerview.widget.DiffUtil
import kotlinx.android.parcel.Parcelize

@Parcelize
data class CertificateListDataModel(
    var certId: String?,
    var examImageUrl: String?,
    var score: String,//成绩
    var proName: String,
    var examName: String,
    var examTime: String,
    var sealImageUrl: String?,//证书印章图片路径
    var content: String?//证书内容HtmlCode
    ) : Parcelable {

    companion object {
        val diffCallback = object : DiffUtil.ItemCallback<CertificateListDataModel>() {
            override fun areItemsTheSame(
                oldItem: CertificateListDataModel,
                newItem: CertificateListDataModel
            ): Boolean {
                return oldItem.certId == newItem.certId
            }

            override fun areContentsTheSame(
                oldItem: CertificateListDataModel,
                newItem: CertificateListDataModel
            ): Boolean {
                return oldItem.certId == newItem.certId
                        && oldItem.examImageUrl == newItem.examImageUrl
                        && oldItem.score == newItem.score
                        && oldItem.proName == newItem.proName
                        && oldItem.examName == newItem.examName
                        && oldItem.examTime == newItem.examTime
                        && oldItem.sealImageUrl == newItem.sealImageUrl
                        && oldItem.content == newItem.content
            }
        }
    }
}